#-----------------------------------------------------
# Introducing Pipeline in PowerShell
#-----------------------------------------------------
Get-Service |
Select-Object ServiceName, Status |
Sort-Object Status -Descending


#-----------------------------------------------------
# Scripting Basics
#-----------------------------------------------------
$currdate = (Get-Date -Format "yyyyMMdd hhmmtt")
$servers = @("ROGUE", "CEREBRO")

#save each servers running services into a file
$servers  |
ForEach-Object {

    $computername = $_
    Write-Host "`n`nProcessing $computername"

    $filename = "C:\Temp\$($computername) - $($currdate).csv"
    
    Get-Service -ComputerName $computername |
    Where-Object -Property Status -EQ "Running" |
    Select-Object Name, DisplayName | 
    Export-Csv -Path $filename -NoTypeInformation
    
}


#-----------------------------------------------------
# Getting Help
#-----------------------------------------------------
Get-Help Get-ChildItem
Get-Help Get-ChildItem -Detailed
Get-Help Get-ChildItem -Examples
Get-Help Get-ChildItem -Full
Get-Help Get-ChildItem -ShowWindow
Get-Help Get-ChildItem -Online


